﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestAppointment.aspx.cs"
    Inherits="School.Pages.Admission.TestAppointment" MasterPageFile="~/MasterALSafa.Master" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <div align="center" dir="rtl">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>


        <asp:Panel ID="pnlAdd" runat="server" Visible="false">
            <table width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td colspan="2" class="admintitle">
                        جدول اختبار القبول للطلبة
                    </td>
                </tr>
                <tr>
                    <td style="width: 160px">
                        <asp:Label ID="Label17" runat="server" CssClass="lab" Text="اسم الاختبار"></asp:Label>
                    </td>
                    <td align="right">
                        <asp:DropDownList ID="ddlTest_Id" runat="server" AutoPostBack="True" 
                            OnSelectedIndexChanged="ddlTest_Id_SelectedIndexChanged">
                        </asp:DropDownList>
                        <asp:Label ID="lblDaysCount" runat="server" CssClass="lab" Text="lblDaysCount" Visible="False"></asp:Label>
                        <asp:Label ID="lblFromDate" runat="server" CssClass="lab" Text="lblFromDate" Visible="False"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td style="width: 160px">
                        <asp:Label ID="Label1" runat="server" CssClass="lab" Text="المجمع"></asp:Label>
                    </td>
                    <td align="right">
                        <asp:DropDownList ID="ddlcampus_Id" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlcampus_Id_SelectedIndexChanged"
                            Enabled="False" Width="200px">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td style="width: 160px">
                        <asp:Label ID="lblCertificate_Id" runat="server" CssClass="lab" Text="نوع الشهادة"></asp:Label>
                    </td>
                    <td align="right">
                        <asp:DropDownList ID="ddlCertificate_Id" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlCertificate_Id_SelectedIndexChanged"
                            Enabled="False" Width="200px">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td style="width: 160px">
                        <asp:Label ID="lblStage_Id" runat="server" CssClass="lab" Text="مرحلة القيد"></asp:Label>
                    </td>
                    <td align="right">
                        <asp:DropDownList ID="ddlStage_Id" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlStage_Id_SelectedIndexChanged"
                            Enabled="False" Width="200px">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td style="width: 160px;">
                        <asp:Label ID="lblGrade_Id" runat="server" Text="الصف" CssClass="lab"></asp:Label>
                    </td>
                    <td align="right">
                        <asp:DropDownList ID="ddlGrade_Id" runat="server" AutoPostBack="True" Height="27px"
                            Enabled="False" Width="200px">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td style="width: 160px;">
                        السنة الدراسية
                    </td>
                    <td align="right">
                        <asp:DropDownList ID="ddlEductionalYear_Id" runat="server" AutoPostBack="True" Enabled="False"
                            Height="26px" Width="200px">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td style="width: 160px">
                        <asp:Label ID="Label19" runat="server" CssClass="lab" Text="المدرسين"></asp:Label>
                    </td>
                    <td align="right">
                        <asp:ListBox ID="ddlTeacher_Id" runat="server" Enabled="False" Rows="3" Width="200px">
                        </asp:ListBox>
                        <br />
                        <asp:Label ID="lblTeacherCount" runat="server" CssClass="lab" Text="" Visible="False"></asp:Label>
                        &nbsp;<asp:Label ID="lblTeacherss" runat="server" CssClass="lab" Text="مدرس"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td style="width: 160px">
                        <asp:Label ID="Label21" runat="server" CssClass="lab" Text="المواد"></asp:Label>
                    </td>
                    <td align="right">
                        <asp:ListBox ID="ddlSubject_Id" runat="server" Enabled="False" Rows="3" Width="200px">
                        </asp:ListBox>
                        <br />
                        <asp:Label ID="lblSubjectCount" runat="server" CssClass="lab" Text="" Visible="False"></asp:Label>
                        &nbsp;<asp:Label ID="lblMins" runat="server" CssClass="lab" Text="دقيقة"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td style="width: 160px">
                        &nbsp;
                    </td>
                    <td align="center">
                        &nbsp;
                        <asp:Label ID="lblCountOfTestStudents" runat="server" CssClass="required" style="text-align: left" 
                            Text="اسم الاختبار"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Label ID="lblMessageAdd" runat="server" CssClass="error"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Button ID="btnSave" runat="server" CssClass="graybutton" OnClick="btnSave_Click"
                            Text="عمل الجدول"  />
                           <%-- OnClick="javascript:return " + "confirm('سيتم حذف كل المواعيد السابقة الخاصة بهذا الاختبار')"--%>
                        &nbsp;<asp:Button ID="btnCancel" runat="server" CssClass="graybutton" CausesValidation="False"
                            OnClick="btnCancel_Click" Text="تفريغ الحقول" />
                        &nbsp;<asp:Button ID="btnend" runat="server" CssClass="graybutton" CausesValidation="False"
                            OnClick="btnend_Click" Text="انهاء" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </div>
    <br />
    <div align="center">
        <asp:Panel ID="pnlbrows" runat="server" Visible="true">
            <table width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td colspan="2" class="admintitle">
                        بحث جدول اختبار القبول للطلبة
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table width="90%" align="center" cellpadding="0" cellspacing="0" border="0">
                            <tr>
                                <td >
                                    <asp:Label ID="Label18" runat="server" CssClass="lab" Text="موعد الاختبار"></asp:Label>
                                </td>
                                <td align="right">
                                    <asp:DropDownList ID="ddlSearchTest_Id" runat="server" AutoPostBack="True" 
                                        OnSelectedIndexChanged="ddlSearchTest_Id_SelectedIndexChanged" 
                                        style="margin-right: 0px">
                                    </asp:DropDownList>
                                    &nbsp;
                                    <asp:Button ID="btnPrintReport" runat="server" CssClass="graybutton" 
                                        OnClick="btnbtnPrintReport_Click" Text="طباعة المواعيد" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="Label15" runat="server" CssClass="lab" Text="المجمع"></asp:Label>
                                </td>
                                <td align="right">
                                    <asp:DropDownList ID="ddlSearchcampus_Id" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlSearchcampus_Id_SelectedIndexChanged"
                                        Enabled="False" Width="200px">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="lblCertificate_Id0" runat="server" CssClass="lab" Text="نوع الشهادة"></asp:Label>
                                </td>
                                <td align="right">
                                    <asp:DropDownList ID="ddlSearchCertificate_Id" runat="server" AutoPostBack="True"
                                        Enabled="False" Width="200px">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="lblStage_Id0" runat="server" CssClass="lab" Text="مرحلة القيد"></asp:Label>
                                </td>
                                <td align="right">
                                    <asp:DropDownList ID="ddlSearchStage_Id" runat="server" AutoPostBack="True" 
                                        Enabled="False" Width="200px">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="lblGrade_Id0" runat="server" CssClass="lab" Text="الصف"></asp:Label>
                                </td>
                                <td align="right">
                                    <asp:DropDownList ID="ddlSearchGrade_ID" runat="server" AutoPostBack="True" 
                                        Enabled="False" Width="200px">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    السنة الدراسية
                                </td>
                                <td align="right">
                                    <asp:DropDownList ID="ddlSearchEductionalYear_Id" runat="server" Width="200px">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td >
                                    <asp:Label ID="Label20" runat="server" CssClass="lab" Text="اسم المدرس"></asp:Label>
                                </td>
                                <td align="right">
                                    <asp:DropDownList ID="ddlSearchTeacher_Id" runat="server" 
                                        Width="200px">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: center;" colspan="2">
                                    <asp:Button ID="btnSearch" runat="server" CssClass="graybutton" OnClick="btnSearch_Click"
                                        Text="بحث" />
                                    &nbsp;<asp:Button ID="btnAdd" runat="server" CssClass="graybutton" OnClick="btnAdd_Click"
                                        Text="عمل جدول جديد" />
                                    &nbsp;<asp:Button ID="btnGetAll" runat="server" CssClass="graybutton" OnClick="btnGetAll_Click"
                                        Text="الكل" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" style="text-align: right">
                                    <asp:Label CssClass="lableface" ID="lblRecordNo" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:GridView Width="100%" AllowPaging="True" AllowSorting="True" ID="griddata" runat="server"
                                        CssClass="Grid" HeaderStyle-CssClass="GridHeaderFooter" FooterStyle-CssClass="GridHeaderFooter"
                                        PagerStyle-CssClass="GridPager" AlternatingRowStyle-CssClass="GridItemAltername"
                                        AutoGenerateColumns="False" OnSelectedIndexChanged="griddata_SelectedIndexChanged"
                                        OnRowDeleting="griddata_RowDeleting" DataKeyNames="Id" OnRowDataBound="griddata_RowDataBound"
                                        OnPageIndexChanging="griddata_PageIndexChanging">
                                        <AlternatingRowStyle CssClass="GridItemAltername" />
                                        <Columns>
                                            <asp:TemplateField HeaderText="المجمع">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblCampus" runat="server" Text='<%# Eval("ADM_Test.ORG_Campus.Name").ToString() %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="الشهادة">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblCertifcate" runat="server" Text='<%# Eval("ADM_Test.ORG_Certificate.Name").ToString() %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="المرحلة">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblStage" runat="server" Text='<%# Eval("ADM_Test.ORG_Stage.Name").ToString() %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="الصف">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblGrade" runat="server" Text='<%# Eval("ADM_Test.ORG_Grade.Name").ToString() %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="الاسم الكامل">
                                                <ItemTemplate>
                                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("TE_Student.Ar_FirstName").ToString() + " " + Eval("TE_Student.Ar_SecondName").ToString() + " " + Eval("TE_Student.Ar_ThirdNmae").ToString()+ " " + Eval("TE_Student.Ar_FourthName").ToString() %>'></asp:Label>
                                                    <asp:Label ID="lblStudentId" runat="server" Text='<%# Eval("TE_Student.Id").ToString() %>' Visible="False"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="Date" DataFormatString="{0:yyyy-MM-dd}" HeaderText="التاريخ" />
                                            <asp:BoundField DataField="Time" DataFormatString="{0:t}" HeaderText="الوقت" />
                                            <asp:TemplateField HeaderText="المدرس">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblTeacher" runat="server" Text='<%# Eval("ORG_Stuff_Teacher.ORG_Stuff.FName").ToString() + " " +  Eval("ORG_Stuff_Teacher.ORG_Stuff.MName").ToString() + " " +  Eval("ORG_Stuff_Teacher.ORG_Stuff.LName").ToString()  %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:CommandField SelectText="ادخال درجات الطالب" ShowSelectButton="True" />
                                            <asp:TemplateField ShowHeader="False">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
                                                        Text="Delete"></asp:LinkButton>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                        <FooterStyle CssClass="GridHeaderFooter" />
                                        <HeaderStyle CssClass="GridHeaderFooter" />
                                        <PagerStyle CssClass="GridPager" />
                                    </asp:GridView>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:Label CssClass="error" ID="lblMessage" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    &nbsp;
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </div>
    <br />
    <asp:Panel ID="pnldetails" runat="server" Visible="false">
        <table align="center" cellpadding="0" cellspacing="0" border="0" width="90%" dir="rtl">
            <tr>
                <td>
                    <asp:DetailsView Width="100%" ID="DetViewdata" runat="server" AlternatingRowStyle-CssClass="GridItemAltername"
                        CssClass="Grid" HeaderStyle-CssClass="GridHeaderFooter" HeaderStyle-Width="30%"
                        AutoGenerateRows="False">
                        <AlternatingRowStyle CssClass="GridItemAltername" />
                        <Fields>
                            <asp:TemplateField HeaderText="المجمع">
                                <ItemTemplate>
                                    <asp:Label ID="lblCampus" runat="server" Text='<%# Eval("ADM_Test.ORG_Campus.Name").ToString() %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="الشهادة">
                                <ItemTemplate>
                                    <asp:Label ID="lblCertifcate" runat="server" Text='<%# Eval("ADM_Test.ORG_Certificate.Name").ToString() %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="المرحلة">
                                <ItemTemplate>
                                    <asp:Label ID="lblStage" runat="server" Text='<%# Eval("ADM_Test.ORG_Stage.Name").ToString() %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="الصف">
                                <ItemTemplate>
                                    <asp:Label ID="lblGrade" runat="server" Text='<%# Eval("ADM_Test.ORG_Grade.Name").ToString() %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="المدرس">
                                <ItemTemplate>
                                    <asp:Label ID="lblTeacher" runat="server" Text='<%# Eval("ORG_Stuff_Teacher.ORG_Stuff.FName").ToString() + " " +  Eval("ORG_Stuff_Teacher.ORG_Stuff.MName").ToString() + " " +  Eval("ORG_Stuff_Teacher.ORG_Stuff.LName").ToString()  %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Fields>
                        <HeaderStyle CssClass="GridHeaderFooter" Width="30%" />
                    </asp:DetailsView>
                </td>
            </tr>
            <tr>
                <td>
                    <input type="button" value="رجوع" onclick="history.go(-1)" class="graybutton" />
                </td>
            </tr>
        </table>
    </asp:Panel>
    <asp:Panel ID="PnlResults" runat="server" Visible="false">
        <table cellpadding="0" cellspacing="0" border="0" width="90%" dir="rtl">
            <tr>
                <td>
                </td>
            </tr>
            <tr>
                <td style="text-align: center">
                    <asp:Label ID="lblSName" runat="server" CssClass="lab" Text="اسم الطالب"></asp:Label>
                </td>
            </tr>
            <tr>
                <td style="text-align: center">
                    <asp:Label ID="lblStudentName" runat="server" CssClass="lab" Text="اسم المدرس"></asp:Label>
                </td>
            </tr>
            <tr>
                <td style="text-align: center">
                    <asp:GridView Width="80%" AllowPaging="True" AllowSorting="True" ID="ResultsGridView"
                        runat="server" CssClass="Grid" HeaderStyle-CssClass="GridHeaderFooter" FooterStyle-CssClass="GridHeaderFooter"
                        PagerStyle-CssClass="GridPager" AlternatingRowStyle-CssClass="GridItemAltername"
                        AutoGenerateColumns="False" OnSelectedIndexChanged="ResultsGridView_SelectedIndexChanged"
                        OnRowDeleting="ResultsGridView_RowDeleting" DataKeyNames="Id" OnRowDataBound="ResultsGridView_RowDataBound"
                        OnPageIndexChanging="ResultsGridView_PageIndexChanging" OnRowEditing="ResultsGridView_RowEditing"
                        OnRowUpdating="ResultsGridView_RowUpdating" OnRowCancelingEdit="ResultsGridView_RowCancelingEdit">
                        <AlternatingRowStyle CssClass="GridItemAltername" />
                        <Columns>
                            <asp:BoundField DataField="Id" HeaderText="Id" />
                            <asp:TemplateField HeaderText="المادة">
                                <ItemTemplate>
                                    <asp:Label ID="lblTeacher" runat="server" Text='<%# Eval("ADM_Test_Subject.Name").ToString() %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="الدرجة">
                                <ItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("Degree")%>' Width="50px"></asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField ShowHeader="False">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
                                        Text="Delete"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle CssClass="GridHeaderFooter" />
                        <HeaderStyle CssClass="GridHeaderFooter" />
                        <PagerStyle CssClass="GridPager" />
                    </asp:GridView>
                </td>
            </tr>
            <tr>
                <td width="50%">
                    <asp:RadioButtonList ID="rblStatusType" runat="server" RepeatDirection="Horizontal"
                        Style="text-align: right">
                        <asp:ListItem Selected="True" Text="ينقل للتنسيق" Value="4"></asp:ListItem>
                        <asp:ListItem Text="اعادة" Value="3"></asp:ListItem>
                        <asp:ListItem Text="مرفوض" Value="2"></asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr>
                <td style="text-align: center">
                    <asp:Label ID="lblMessageDetails" runat="server" CssClass="error"></asp:Label>
                </td>
            </tr>
            <tr>
                <td style="text-align: center">
                    <asp:Button ID="btnUpdateDegree" runat="server" CausesValidation="False" CssClass="graybutton"
                        OnClick="btnUpdateDegree_Click" Text="حفظ النتائج" />&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btnChangeStatus" runat="server" CausesValidation="False" CssClass="graybutton"
                        OnClick="btnChangeStatus_Click" Text="تغيير حالة الطالب" />&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btnend0" runat="server" CausesValidation="False" CssClass="graybutton"
                        OnClick="btnend_Click" Text="انهاء" />
                    &nbsp;
                </td>
            </tr>
    </asp:Panel>

</asp:Content>
